<template>
  <div class="timeline-container">
    <el-timeline>
      <!-- 遍历时间轴项目 -->
      <el-timeline-item v-for="(item, index) in timelineData" :key="index" :timestamp="item.timestamp" placement="top">
        <el-row :gutter="10" class="card-row">
          <!-- 每个项目中的多个 el-card -->
          <el-col :span="4" v-for="(card, idx) in item.cards" :key="idx">
            <el-card shadow="hover" class="compact-card">
              <div slot="header" class="card-header">
                <span>{{ card.title }}</span>
              </div>
              <div>{{ card.duration }} 分钟</div>
              <div>{{ card.description }}</div>
            </el-card>
          </el-col>
        </el-row>
      </el-timeline-item>
    </el-timeline>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 时间轴数据
      timelineData: [
        {
          timestamp: "2024/11/08",
          cards: [
            { title: "电刺激", duration: "5.0", description: "促循环电刺激" },
            { title: "电刺激", duration: "10.0", description: "II 类肌高强度" },
            { title: "电刺激", duration: "10.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "促循环电刺激" },
          ],
        },
        {
          timestamp: "2024/11/12",
          cards: [
            { title: "电刺激", duration: "5.0", description: "促进环电刺激" },
            { title: "电刺激", duration: "15.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "I 类肌低强度" },
            { title: "触发电刺激", duration: "5.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "促循环电刺激" },
          ],
        },
        
        {
          timestamp: "2024/11/16",
          cards: [
            { title: "电刺激", duration: "5.0", description: "促进环电刺激" },
            { title: "电刺激", duration: "15.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "I 类肌低强度" },
            { title: "触发电刺激", duration: "5.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "促循环电刺激" },
          ],
        },
        {
          timestamp: "2024/11/22",
          cards: [
            { title: "电刺激", duration: "5.0", description: "促进环电刺激" },
            { title: "电刺激", duration: "15.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "I 类肌低强度" },
            { title: "触发电刺激", duration: "5.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "促循环电刺激" },
            { title: "kegel训练", duration: "5.0", description: "I 型肌初步训练" },
          ],
        },
        {
          timestamp: "2024/11/26",
          cards: [
            { title: "电刺激", duration: "5.0", description: "促进环电刺激" },
            { title: "电刺激", duration: "15.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "I 类肌低强度" },
            { title: "触发电刺激", duration: "5.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "促循环电刺激" },
            { title: "kegel训练", duration: "5.0", description: "I 型肌初步训练" },
          ],
        },
        {
          timestamp: "2024/11/30",
          cards: [
            { title: "电刺激", duration: "5.0", description: "促进环电刺激" },
            { title: "电刺激", duration: "15.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "I 类肌低强度" },
            { title: "触发电刺激", duration: "5.0", description: "I 类肌高强度" },
            { title: "电刺激", duration: "5.0", description: "促循环电刺激" },
            { title: "电刺激", duration: "5.0", description: "促循环电刺激" },
          ],
        },
        {
          timestamp: "2024/12/01",
          cards: [
            { title: "电刺激", duration: "7.0", description: "促进环电刺激" },
            { title: "电刺激", duration: "8.0", description: "II 类肌高强度" },
          ],
        },
      ],
    };
  },
};
</script>

<style scoped>
.timeline-container {
  padding: 15px;
}
.card-row {
  margin-bottom: 10px; /* 更小的行间距 */
}

.compact-card {
  width: 140px; /* 更紧凑的宽度 */
  height: 100px; /* 更紧凑的高度 */
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-header {
  font-weight: bold;
  margin-bottom: 6px;
}
</style>
